package com.aiit.service.Impl;

import com.aiit.mapper.JobMapper;
import com.aiit.pojo.Job;
import com.aiit.service.JobService;
import com.aiit.vo.PageResultVo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: LuTao
 * @Date: 2022/05/09/9:30
 */
@Service("jobService")
public class JobServiceImpl extends ServiceImpl<JobMapper, Job> implements JobService {
    @Autowired
    private JobMapper jobMapper;

    @Override
    public List<Job> getJobsByConditionInPage(int skipCount, String jobName, String education, String experience, String startCreateTime, String city, String business) {
        return jobMapper.getJobsByConditionInPage(skipCount,jobName,education,experience,startCreateTime,city,business);
    }

    @Override
    public PageResultVo<Job> getByCondition(Long page, Long limit, String job, String education, String area, String business, String startDate, String endDate) {
        PageResultVo<Job> pageResultVo = new PageResultVo<>();
        pageResultVo.setRecords(jobMapper.getByCondition((page-1)*limit,limit,job,education,area,business,startDate,endDate));
        pageResultVo.setTotal(jobMapper.getCountByCondition(job,education,area,business,startDate,endDate));
        return pageResultVo;
    }
}
